package com_7;

import java.util.*;

public class Tset1 {
    public static void main(String[] args) {//main方法入口
        Scanner sc = new Scanner(System.in);//键盘录入对象
        System.out.println("请输入字符串");
        String line = sc.nextLine();//
        TreeMap<Character, Integer> treemap = new TreeMap<Character, Integer>();//
        char[] chars = line.toCharArray();//
        for (char c : chars) {//
            if (treemap.containsKey(c)) {//
                treemap.put(c, treemap.get(c)+1);//
            } else {//
                treemap.put(c, 1);// }
        }
            Set<Map.Entry<Character, Integer>> entry =treemap.entrySet();
            for (Map.Entry<Character, Integer> entryset : entry) {
                System.out.print(entryset.getKey()+"("+entryset.getValue()+")");
            }

        }
    }
}
